package com.maque.nacos.order.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author Limi
 * @create 2020-11-27 15:46
 */
@RestController
@RefreshScope
public class OrderController {

    @Value("${order.name}")
    private String orderName;

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/getOrder")
    public String getOrder() {
        return orderName +":"+ restTemplate.getForObject("http://nacos-course/getCourse", String.class);
    }

}
